package com.fxcalibre.hibernate.dao;

import java.util.List;

import com.fxcalibre.db.beans.Person;
import com.fxcalibre.hibernate.HibernateUtils;

public class PeopleDAO
{
	@SuppressWarnings("unchecked")
	public static List<Person> getPeople()
	{
		return (List<Person>) HibernateUtils.buscar(Person.crearCriterio());
	}

	@SuppressWarnings("unchecked")
	public static List<Person> getDirectors()
	{
		String query = "SELECT distinct c.pk.person FROM  Crew c where c.pk.role = 'Director'";
		return (List<Person>) HibernateUtils.executeQuery(query);
	}

	@SuppressWarnings("unchecked")
	public static List<Person> getActors()
	{
		String query = "SELECT distinct c.pk.person FROM  Crew c where c.pk.role = 'Actor'";
		return (List<Person>) HibernateUtils.executeQuery(query);
	}
}
